Skip to content

feat(model-prices): edit special pricing rules - #791

Merged
seakee merged 1 commit into
seakee:devfrom
camy-x:feat/edit-model-pricing-rules
Sep 16, 2026
Merged

seakee merged 1 commit into
seakee:devfrom
camy-x:feat/edit-model-pricing-rules

Conversation

@camy-x

@camy-x camy-x commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Summary

Editing a synced model price currently removes all long-context and service-tier rules. This adds rule editors that preserve existing rules and let users add, update, or remove their overrides.

Scope

  • Frontend panel
  • Manager Server
  • CPA panel mode
  • Full Docker mode
  • Native packages / release
  • Docs / Wiki
  • CI / build / tooling

Changes

  • Load context-threshold and service-tier rules into the manual price editor, including inherited fields and explicit zero prices.
  • Add rule creation, deletion, validation, deterministic normalization, responsive overflow, and translations for every supported locale.

User Impact

Users can edit base prices without losing synchronized pricing rules, and can manually configure long-context or service-tier overrides from the model prices page.

Compatibility / Runtime Notes

  • CPA panel mode: N/A; model price management requires Manager Server.
  • Manager Server mode: Uses the existing model-price payload and validation contract; no API or storage migration.
  • Full Docker / native packages: Same frontend behavior when Manager Server model pricing is available.

Data / Security Notes

N/A. The change only edits the existing model-price payload and does not touch credentials or usage events.

Risk / Rollback

Risk level: Low

Rollback notes: Revert this commit to restore the previous base-price-only editor.

Verification

  • Type check
  • Lint
  • Tests
  • Build
  • Manual UI check
  • Docs/link check
  • Not applicable, docs-only

Commands / evidence:

node_modules/.bin/tsc -p apps/web/tsconfig.json --noEmit
node_modules/.bin/eslint apps/web/src --ext ts,tsx --report-unused-disable-directives  # 0 errors; 5 pre-existing warnings
cd apps/web && ../../node_modules/.bin/vitest run src  # 232 files, 3,531 tests passed
cd apps/web && ../../node_modules/.bin/vite build

Local demo checks covered the empty editor, both rule types, existing rule values, desktop layout, and narrow-layout horizontal scrolling. The review follow-up also adds a combined component regression test that preserves existing rules and refreshes model-price attention after save.

Screenshots / Recordings

N/A — verified in the local demo; no binary artifact was added to the repository.

Docs

  • README / README_CN updated for user-visible capabilities
  • Matching docs manual and navigation updated
  • Demo fixtures, screenshots, and deep links reviewed
  • Release notes needed
  • Not needed — explanation included below

Docs decision: The model prices page contains inline localized descriptions for both rule types, and the existing Manager Server payload contract is unchanged.

Related

Fixes #703

@seakee

seakee commented Sep 16, 2026

Copy link
Copy Markdown
Owner

Thanks for the PR. The overall direction looks correct and still matches #703.

However, #793 has now been merged into dev, and it overlaps with this PR in the Model Prices page/model files. The PR is currently in a conflicted state, so please update it against the latest dev and resolve the conflicts before we continue with the merge.

When resolving the conflicts, please keep the latest #793 behavior as the baseline and re-apply the special pricing rule editor on top of it. In particular:

Please also add a regression test covering the combined behavior: editing/saving an existing model with context/service-tier rules should preserve those rules and still trigger the model-price attention refresh after a successful save.

There is no need to expand this PR into route-prefix automatic pricing-rule matching. If that remains reproducible after #792/#793, we can track it separately.

@camy-x
camy-x force-pushed the feat/edit-model-pricing-rules branch from 66f6290 to 2680e6e Compare September 16, 2026 08:48
@camy-x
camy-x force-pushed the feat/edit-model-pricing-rules branch from 2680e6e to f4e66ef Compare September 16, 2026 08:51
@camy-x

camy-x commented Sep 16, 2026

Copy link
Copy Markdown
Contributor Author

Updated this PR onto the latest dev and resolved the #793 overlap.

  • Preserved runtime model discovery and buildModelPriceRows(..., attention.runtimeModels).
  • Preserved the pending-sync attention flow and all pending_sync_badge translations.
  • Kept special pricing-rule validation before save and attention.check({ force: true }) after a successful save.
  • Removed the obsolete rule-clearing warning while retaining both sets of tests.
  • Added the requested combined regression test: editing an existing price preserves context/service-tier rules and refreshes model-price attention after save.

Validation now passes locally (3,531 frontend tests, type check, production build, and lint with 0 errors), and all required GitHub checks are green on the updated commit.

@seakee
seakee merged commit 9435794 into seakee:dev Sep 16, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants